local fs = require("rocks.fs")
local tempdir = vim.fn.tempname()
describe("rocks.fs", function()
    it("mkdir_p", function()
        local dir = vim.fs.joinpath(tempdir, "bar", "baz", "bat")
        fs.mkdir_p(dir)
        assert.is_not_nil(vim.uv.fs_stat(dir))
    end)
    it("expand_path", function()
        vim.env.EXPAND_PATH_ENV = "/home/user/config"
        assert.same(fs.expand_path("myfile.txt"), "myfile.txt")
        assert.same(fs.expand_path("$EXPAND_PATH_ENV/mydir"), "/home/user/config/mydir")
    end)
    it("get_absolute_path", function()
        vim.env.EXPAND_PATH_ENV = "/home/user"
        assert.same(fs.get_absolute_path("$EXPAND_PATH_ENV/mybase", "$EXPAND_PATH_ENV/mydir"), "/home/user/mydir")
        assert.same(fs.get_absolute_path("$EXPAND_PATH_ENV/mybase", "myfile.txt"), "/home/user/mybase/myfile.txt")
    end)
end)
